package connTestpac;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class Test {

	public static void main(String[] args) {
		try{
			  Class.forName("oracle.jdbc.driver.OracleDriver");
			  String url="jdbc:oracle:thin:@127.0.0.1:1521:xe";
			  Connection conn=DriverManager.getConnection(url,"leon","12345678");
			  String sql="SELECT * FROM goodsinfo WHERE goodsid=2";
			  PreparedStatement ps=conn.prepareStatement(sql);
			  ResultSet rs=ps.executeQuery();
			  if(rs.next()){
			  System.out.println("rs.getString(1)");
			    }
			  else{System.out.println("Error");}
			  }catch(Exception e){
			  System.out.println(e);
			  }
			  
	}

}
